package com.seu.me.disruptor.base;

import com.lmax.disruptor.EventHandler;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.util.Date;

/**
 * 事件消费者，也就是一个事件处理器。这个事件处理器简单地把事件中存储的数据打印到终端
 * <p>
 * Created by liangfeihu on 2017/11/26.
 */
public class LongEventHandler implements EventHandler<LongEvent> {

    @Override
    public void onEvent(LongEvent longEvent, long l, boolean b) throws Exception {
        System.out.println("value=" + longEvent.getValue() + ", time=" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
    }

}
